import { createStore } from 'vuex'

import getters from "./getters";
const modulesFiles: any = require.context("./modules", true, /\.ts$/);
const modules: any = modulesFiles.keys().reduce((modules: any, modulePath: any) => {
    const moduleName: any = modulePath.replace(/^\.\/(.*)\.\w+$/, "$1");
    const value = modulesFiles(modulePath);
    modules[moduleName] = value.default;
    return modules;
}, {});
// console.log(modules) //得到的是 modules 下边所有文件的对象
const store = createStore({
    modules,
    getters
});
export default store;
